<template>
	<view class="">
		<view class="">
			<view class="">
				<view class="u-f-ajc servicecontent u-f-jsb" v-if="uesrList.length > 0">
					<u-grid :border="false" col="2">
						<u-grid-item v-for="(item,index) in uesrList" :key="index">
							<view class="serviceitem" @click="itemClick(index)">

								<image :src="item.imgList[0]" mode="scaleToFill" lazy-load
									style="margin: 15rpx;border-radius: 50rpx;box-shadow: 2px 3px 16px 0px rgba(4, 14, 35, 0.16);width: 335rpx;height: 420rpx;position: absolute;left: 0;right: 0;top: 0;bottom: 0;">
								</image>
								<view
									style="margin-left: 15rpx;position: absolute;bottom: 90rpx; z-index: 9999;width: 100%;color: white;">
									{{item.name}}
								</view>
								<view
									style="margin-left: 15rpx;position: absolute;bottom: 40rpx; z-index: 9999;width: 100%;color: white;">
									{{item.age}}岁 · {{item.height}}cm
								</view>
								<!-- <view style="margin-left: 15rpx;position: absolute;bottom: 60rpx; z-index: 9999;width: 100%;color: white;">
								
							</view> -->
							</view>
						</u-grid-item>
					</u-grid>
				</view>
				<view class="" v-else>
					<empty></empty>
				</view>
			</view>
		</view>

	</view>
</template>

<script>
	var _self;
	import {
		LikingList
	} from '@/common/api.js'
	import empty from '@/components/empty.vue';
	export default {
		data() {
			return {
				uesrList: [],
				liking: ''
			}
		},
		components: {
			empty
		},
		onLoad(options) {
			_self = this;
			_self.liking = options.liking;
		},
		onShow() {
			_self.getLikingList();
		},
		methods: {
			getLikingList() {
				LikingList({
					userId: this.vuex_userid,
					status: _self.liking
				}).then(res => {
					_self.uesrList = res.data;
					for (var i = 0; i < _self.uesrList.length; i++) {
						var imgList = [];
						if (_self.uesrList[i].img1) {
							imgList.push(_self.vuex_api + '/sysFileInfo/preview?id=' + _self.uesrList[i].img1)
						}
						if (_self.uesrList[i].img2) {
							imgList.push(_self.vuex_api + '/sysFileInfo/preview?id=' + _self.uesrList[i].img2)
						}
						if (_self.uesrList[i].img3) {
							imgList.push(_self.vuex_api + '/sysFileInfo/preview?id=' + _self.uesrList[i].img3)
						}
						_self.uesrList[i].imgList = imgList;
					}
					console.log('this.uesrList[index].userId = ', this.uesrList);
				}).catch({

				})
			},
			itemClick(index) {

				uni.navigateTo({
					url: '/pageslike/userDetail?userId=' + this.uesrList[index].userId + '&friendStatus=' +
						_self
						.liking
				})


			}
		}
	}
</script>

<style>
	.u-f-ajc {
		display: flex;
		align-items: center;
		justify-content: center;
	}

	.servicecontent {
		flex-wrap: wrap;
		margin-top: 10rpx;
	}

	.serviceitem {
		width: 335rpx;
		height: 450rpx;
	}

	.serviceitem>view>view:nth-child(2) {
		font-size: 35rpx;
		font-weight: 500;
	}

	.serviceitem>view>view:nth-child(3) {
		font-size: 25rpx;
		color: #8B8E90;
	}
</style>